package net.eicp.jxcontent.template

import net.liftweb.common._
import net.liftweb.http._
import net.liftweb.http.S._
import net.liftweb.util._
import net.liftweb.util.Helpers._
import scala.xml._
import net.liftmodules.JQueryModule
import net.eicp.jxcontent.core.util.PluginBoot
import net.eicp.jxcontent.template.util.JXTemplateDispatch

class Boot extends PluginBoot {
  
  val logger = Logger(getClass)
  
  def boot {
    
    JXTemplateDispatch.addContent("render1", s"""
        import net.eicp.jxcontent.template.snippet.JXTemSnippet
        import net.eicp.jxcontent.core.macroimpl.JXCopyAble
        import net.eicp.jxcontent.core.macroimpl.JXCopy
        import net.liftweb.common._
        import net.liftweb.http._
        import net.liftweb.http.S._
        import net.liftweb.util._
        import net.liftweb.util.Helpers._
        import net.liftweb.mapper._
        import scala.xml._
        import net.eicp.jxcontent.core.snippet.JXSnippetScope
        
        class 英董你是我的小激萌啊 extends JXTemSnippet {
        
          override def dispatch = { case "render1" => render1 _ }
        
          def render1(scope: JXSnippetScope) = {
            4 === { xhtml =>
              ("#ad *+" #> "你是我的小激萌啊！！！").apply(xhtml)
            }
          }
        
        }
        
        JXCopy[英董你是我的小激萌啊]
    """)
    
    appendSnippetDis{
      case keyName if (JXTemplateDispatch hasKey keyName) && !(JXTemplateDispatch isCurrentCompile keyName) => JXTemplateDispatch(keyName)
    }
    
  }
  
}